
<?php



function getInfo($from, $to, $str)
{
    preg_match_all('/'.$from.'(.*?)'.$to.'/si', $str,$info);
    // print_r($info);//print the array
    return $info[1];
}

function unescape($str) {
    $str = rawurldecode($str);
    preg_match_all("/(?:%u.{4})|&#x.{4};|&#\d+;|.+/U",$str,$r);
    $ar = $r[0];
    //print_r($ar);
    foreach($ar as $k=>$v) {
        if(substr($v,0,2) == "%u"){
            $ar[$k] = iconv("UCS-2BE","UTF-8",pack("H4",substr($v,-4)));
  }
        elseif(substr($v,0,3) == "&#x"){
            $ar[$k] = iconv("UCS-2BE","UTF-8",pack("H4",substr($v,3,-1)));
  }
        elseif(substr($v,0,2) == "&#") {
            
            $ar[$k] = iconv("UCS-2BE","UTF-8",pack("n",substr($v,2,-1)));
        }
    }
    return join("",$ar);
}


   
  $f = new SaeFetchurl();
  $link=$_GET["link"];


$link="http://jr12.blog.163.com/blog/static/".$link."/";
  $notic = $f->fetch($link);


$from='<title>';  
$to='<\/title>';
$arr = getInfo($from, $to, $notic);
$title = trim($arr[0]);
//$title=unescape($title);

$from = '<div\sclass="bct fc05 fc11 nbw-blog ztag">';
$to = '<\/div>';
$arr = getInfo($from, $to, $notic);
$text = trim($arr[0]);
//$text=unescape($text);

?>
<html>
<head>
      <script>
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
WeixinJSBridge.call('hideOptionMenu');
});
    </script>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
 <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  
<title><?php echo $title;?></title>
</head>

<body>
    <h2 algin="middle"> <?php echo $title ?>
	<?php echo $text;  ?>

        
        
</body>
</html>
















